package com.example.licensingServer.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.example.licensingServer.model.License;
import com.example.licensingServer.service.LicenseService;

@RestController
@RequestMapping(value="/v1/organizations/{organizationId}/licenses")
public class LicenseServiceController {
	@Autowired
	private LicenseService licenseService;
	
	@RequestMapping(value="/{licenseId}",method = RequestMethod.GET)
	public License getLicenses(
		@PathVariable("organizationId") String organizationId,
		@PathVariable("licenseId") String licenseId) {
		/*
		License license = new License();
		license.setLicenseId(licenseId);
		license.setOrganizationId(organizationId);
		license.setLicenseType("seat");
		*/
		License license = licenseService.getLicense(organizationId, licenseId);
		return license;
	}
}
